Import('RTT_ROOT')
Import('rtconfig')
from building import *

cwd     = GetCurrentDir()
src     = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd, str(Dir('#'))]

if rtconfig.PLATFORM in ['gcc']:
    src += Glob(RTT_ROOT + '/bsp/rockchip/common/drivers/drv_cache_gcc.S')
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
    src += Glob(RTT_ROOT + '/bsp/rockchip/common/drivers/drv_cache_arm.s')
elif rtconfig.PLATFORM in ['iccarm']:
    src += Glob(RTT_ROOT + '/bsp/rockchip/common/drivers/drv_cache_iar.s')

group = DefineGroup('driver', src, depend = [''], CPPPATH = CPPPATH)

# build for sub-directory
list = os.listdir(cwd)
objs = []

for d in list:
    path = os.path.join(cwd, d)
    if os.path.isfile(os.path.join(path, 'SConscript')):
        objs = objs + SConscript(os.path.join(d, 'SConscript'))
group = group + objs

Return('group')
